clap_complete_nushell
Generates Nushell completions for clap
based CLIs
Examples
myapp.rs
use ;
use generate;
use Nushell;
use io;
myapp.nu
module completions {
def "nu-complete myapp choice" [] {
[ "first" "second" ]
}
# Tests completions
export extern myapp [
file?: string # some input file
--config(-c) # some config file
--conf # some config file
-C # some config file
choice?: string@"nu-complete myapp choice"
--version(-V) # Print version
]
# tests things
export extern "myapp test" [
--case: string # the case to test
--version(-V) # Print version
]
# top level subcommand
export extern "myapp some_cmd" [
--version(-V) # Print version
]
def "nu-complete myapp some_cmd sub_cmd config" [] {
[ "\"Lest quotes aren't escaped.\"" ]
}
# sub-subcommand
export extern "myapp some_cmd sub_cmd" [
--config: string@"nu-complete myapp some_cmd sub_cmd config" # the other case to test
--version(-V) # Print version
]
}
use completions *